package com.ambitor.ipro.labelParser;

import java.util.List;

import com.ambitor.grass.util.data.IData;
import com.ambitor.ipro.exceptions.ProException;
import com.ambitor.ipro.service.TopService;
import com.taobao.api.domain.Item;

public class LatestListLabelParser extends IntellLabelParser {

	public LatestListLabelParser() {
	}

	public LatestListLabelParser(TopService topService, IData userSession,
			int num) {
		this.setTopService(topService);
		this.setUserSession(userSession);
		this.setNum(num);
	}

	@Override
	public List<Item> parse() throws ProException {
		String sessionId = this.getUserSession().getString("SESSION_ID");
		String nick = this.getUserSession().getString("NICK");
		TopService topService = this.getTopService();
		return topService.getOnSaleItemsOrderByCertainField(sessionId, nick,
				this.getNum(), "list_time", "desc");
	}
}
